<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<body>
<div id="myApp">
    <h1>todoList</h1>
    <input v-model="showContent">
    <button @click="add">提交</button>
    <ul>
        <li v-for="(name,index) of list" :key="index" v-text="name"></li>
    </ul>

</div>
</body>
<script>
    new Vue({
        el: "#myApp",
        data: {
            showContent: "",
            list: []
        },
        methods: {
            add: function () {
                this.list.push(this.showContent);
                this.showContent = "";
            }
        }
    })

</script>
</html>